24. Exercise: Send Data

Sending Data Between Activities

Now it's your turn. In this quiz, you will add code to send the String from the clicked list item to the DetailActivity and display it. Complete the TODOs in Exercise: S04.02-Exercise-DisplayDayForecast.

SOLUTION:
  • Use the putExtra method to add the String that was clicked into the Intent used to start the DetailActivity.
  • Safely retrieve the extra String from the Intent inside the DetailActivity.
  • Add a TextView to your layout and set the text of the TextView with the String from the Intent extra.